package demo;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: rei
 * Date: 2025-11-26
 * Time: 18:05
 */
public class FileReader_test {

    public static void main(String[] args) throws IOException {
        File file = new File("c:/temp/123.txt");
        //创建字符读取,一次读一个字符
        FileReader fileReader = new FileReader(file);

        while(true){
            int data = fileReader.read();
            if (data == -1){
                break  ;
            }
            System.out.println(data);
        }

        fileReader.close();
    }
}
